from datetime import datetime
from typing import Optional, List
from pydantic import BaseModel
from app.schemas.common import PaginationParams
from tortoise.contrib.pydantic import pydantic_model_creator
from app.models.system_access_log_model import AccessLogModel

AccessLog_Pydantic = pydantic_model_creator(AccessLogModel, name="AccessLog", exclude=["is_delete", "deleted_at"])


class AccessLogItem(AccessLog_Pydantic):
    pass


class AccessLogQueryParams(BaseModel):
    path: Optional[str] = None
    method: Optional[str] = None
    status_code: Optional[int] = None
    ip: Optional[str] = None
    start_time: Optional[datetime] = None
    end_time: Optional[datetime] = None
